package com.school.appleforgetbackend.service;

import com.school.appleforgetbackend.BO.request.HomeRequest;
import com.school.appleforgetbackend.BO.request.SwxxRequest;
import com.school.appleforgetbackend.BO.response.*;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Service;

// 添加FastJSON导入
import com.alibaba.fastjson.JSON;
import org.springframework.web.bind.annotation.RequestBody;

@Service
@ConditionalOnProperty(prefix = "mock.service", name = "user", havingValue = "true")
public class MockUnderService implements UnderService {
    @Override
    public SwxxResponse getswxx(SwxxRequest body) {
        return null;
    }

    @Override
    public EquipmentResponse getssqk(SwxxRequest body) {
        return null;
    }

    @Override
    public WaterQualityResponse getQuality(SwxxRequest body) {
        return null;
    }

    @Override
    public TrafficResponse getFlowData(SwxxRequest body) {
        return null;
    }

    @Override
    public ReWellResponse gethbj(SwxxRequest body) {
        return null;
    }

    @Override
    public SbEquipmentResponse getsbqk(SwxxRequest body) {
        return null;
    }

    @Override
    public AnalyzeResponse getbsfx(SwxxRequest body) {
        return null;
    }

    @Override
    public ReWellingResponse gethuibu(SwxxRequest body) {
        return null;
    }

    @Override
    public LayeringResponse getjcjqfcb(SwxxRequest body) {
        return null;
    }

    @Override
    public JcWellEntityResponse getjcjqlist(SwxxRequest body) {
        return null;
    }

    @Override
    public JcEquipmentResponse getjcjqsbqk(SwxxRequest body) {
        return null;
    }

    @Override
    public JcResponse getjiance(@RequestBody SwxxRequest swxxRequest) {
        return null;
    }

    @Override
    public SwxxResponse getHomeswxx(SwxxRequest body) {
        return null;
    }

    @Override
    public CumulativeResponse getHomeljsc(SwxxRequest body) {
        String json = "{\n" +
                "    \"code\": \"0000\",\n" +
                "    \"msg\": \"请求成功\",\n" +
                "    \"data\": [\n" +
                "        {\n" +
                "            \"areaName\": \"运河区\",\n" +
                "            \"backfillCount\": \"0.0\",\n" +
                "            \"backfillTime\": \"0.0\"\n" +
                "        },\n" +
                "        {\n" +
                "            \"areaName\": \"乐亭县\",\n" +
                "            \"backfillCount\": \"0.0\",\n" +
                "            \"backfillTime\": \"0.0\"\n" +
                "        },\n" +
                "        {\n" +
                "            \"areaName\": \"桃城区\",\n" +
                "            \"backfillCount\": \"159675.65\",\n" +
                "            \"backfillTime\": \"0.0\"\n" +
                "        },\n" +
                "        {\n" +
                "            \"areaName\": \"阜城县\",\n" +
                "            \"backfillCount\": \"48209.29\",\n" +
                "            \"backfillTime\": \"0.0\"\n" +
                "        }\n" +
                "    ],\n" +
                "    \"timestamp\": \"2025-09-21 20:36:47\",\n" +
                "    \"executionTime\": \"\"\n" +
                "}";

        try {
            CumulativeResponse response = JSON.parseObject(json, CumulativeResponse.class);
            return response;
        } catch (Exception e) {
            // 处理JSON解析异常
            System.err.println("Error parsing mock JSON: " + e.getMessage());
            // 创建并返回一个默认的错误响应
            CumulativeResponse errorResponse = new CumulativeResponse();
            // 如果SwxxResponse类有相关的setter方法，可以设置错误信息
            // 这里假设SwxxResponse类有setCode和setMsg方法
            // errorResponse.setCode("9999");
            // errorResponse.setMsg("模拟数据解析失败");
            return errorResponse;
        }
    }

    @Override
    public CountAndEchoResponse getHomejqtj(SwxxRequest body) {
        return null;
    }

    @Override
    public WellResponse getHomejqfb(HomeRequest homeRequest) {
        return null;
    }

    @Override
    public InformationResponse getGroundList(SwxxRequest body) {
        return null;
    }


    @Override
    public ExperimentResponse getTestList(SwxxRequest body) {
        return null;
    }

    @Override
    public BDExperimentResponse getTestResourceList(SwxxRequest swxxRequest) {
        return null;
    }
}

